
import React from 'react'
import router from 'umi/router'
import api from '@/services'
import { message } from 'antd'
import WpForm from '@/components/wp-form'
import styles from './index.scss'

const { SAReg } = api
const index = () => {
  const submit = values => {
    // const sign = localStorage.getItem('sign')
    const openId = localStorage.getItem('openId')
    const data = {
      ...values,
      agentId: 0,
      openId
    }
    SAReg({
      sign: `${JSON.stringify(data)}$$##1234ech**`.MD5(32),
      data
    })
      .then(res => {
        console.log('res', res)
        if (res.success) {
          message.success('注册成功！')
          router.replace('/')
        }
      })
  }

  return (
    <div className={styles.register}>
      <WpForm submit={submit} />
    </div>
  )
}

export default index
